<div>
  <div class="row">
    <div class="col-md-12">
      <div class="card admin-content-type-edit">
        <div class="card-header">
          <i class="fa fa-align-justify edit-content-type"></i> Add Module {{ this.data.title }}
        </div>

        <div class="card-body">

          <script type='text/javascript'>
            window.onload = function () {
              Formio.createForm(document.getElementById('createContentTypeForm'), {
                components: [
                  {
                    type: 'textfield',
                    key: 'title',
                    label: 'Module Title',
                    placeholder: 'Enter the title of your new module (ie: Service List, News Feed, Public Service).',
                    input: true
                  },
                  {
                    type: 'textfield',
                    key: 'systemId',
                    label: 'SystemId',
                    placeholder: 'Enter the slug to be used as the system id (ie: service-list, news-feed, public-service)',
                    input: true,
                    calculateValue: "value = helperService.slugify(data.title);",
                  },
                  {
                    type: 'checkbox',
                    key: 'enabled',
                    label: 'Enabled',
                    input: true
                  },
                  {
                    type: 'checkbox',
                    key: 'canBeAddedToColumn',
                    label: 'Can Be Added To Column',
                    input: true
                  },
                  {
                    type: 'button',
                    action: 'submit',
                    label: 'Create Module',
                    theme: 'primary'
                  }
                ]
              })
                .then(async function (form) {
                  form.submission = {
                    data: { canBeAddedToColumn: true, enabled: true }
                  };
                  form.on('submit', async function (submission) {

                    await dataService.moduleCreate(submission);
                    window.location.replace('/admin/modules');

                  });
                });
            }
          </script>

          <div id="createContentTypeForm"></div>
        </div>

      </div>

    </div>
    <!--/.col-->
  </div>

</div>
